package com.fengye.api.controller;

import com.fengye.common.controller.BaseController;
import com.fengye.common.domain.ResponseResult;
import com.fengye.common.domain.vo.CategoryVo;
import com.fengye.api.service.CategoryService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import java.util.List;

/**
 * CategoryController
 *
 * @author 枫叶fy
 * @description 分类控制器
 * @since 2024/2/25 15:55
 */
@Api(tags = "文章分类模块")
@RestController
@RequestMapping("/category")
public class CategoryController extends BaseController {
    @Resource
    private CategoryService categoryService;

    /**
     * 查询分类列表
     * @return 分类列表
     */
    @RequestMapping(path = "/list", method = {RequestMethod.GET})
    public ResponseResult<List<CategoryVo>> getCategoryList() {
        List<CategoryVo> categoryVos = categoryService.getCategoryList();
        return ResponseResult.success(categoryVos);
    }
}
